#coding=utf-8
import requests,json

url='http://172.16.70.246/test/oa_auth/login'
headers={'Content-Type':'application/json'}
data={}
data['userNumber']='20280'
data['password']='000000'
ree = requests.post(url,data=json.dumps(data),headers=headers)
re=json.loads(ree.content)
token = re['data']['token']
# print (token)

url1='http://172.16.70.246/test/oa_personnel/employeeInfo/list'
headers1={'Authorization':token,'Content-Type':'application/json'}
data1={
    "clientPostName": "",
    "clientPostLevelName": "",
    "accountManager": [],
    "degrees": [],
    "employeeSexes": [],
    "employeeStatuses": [],
    "attributionIds": [],
    "whetherBackbones": [],
    "orgIds": [],
    "currentPage": 1,
    "degree": "",
    "dimission": 0,
    "employeeName": "",
    "employeeSex": "",
    "hireDate": "",
    "ids": [],
    "pageSize": 400,
    "regularizatio": "",
    "clientOrganizationIds": []
}
ree1 = requests.post(url1,data=json.dumps(data1),headers=headers1)
re1 = json.loads(ree1.text)
list1=re1['data']['records']

aa={}
for i in list1:
    aa[i['employeeId']]=i['hireDate']
# print(aa)
#员工无机构合同
url2='http://172.16.70.246/test/oa_personnel/riskControl/pageNoHandleEmployeeNoContract'
headers2={'Authorization':token,'Content-Type':'application/json'}
data2={"employeeName":"","employeeIdOrName":"","clientIds":[],"accountManagerIds":[],"riskResults":[],"orgIds":[],"reconciliationMonth":"","missingInfoItem":[],"companyManagerId":[],"crmClientIds":[],"riskCloseReasons":[],"reconciliationStartMonth":"","reconciliationEndMonth":"","riskCloseStartDate":"","riskCloseEndDate":"","riskCauseEndTime":"","closeRiskControlReasons":[],"contractStartDateOrder":"asc","contractEndDateOrder":"asc","crmCmAndCms":[],"dateRange":[],"riskLevels":[],"riskCauseStartTime":"","riskProduceDateOrder":"desc","sortFields":"","sortRule":"","pageNo":1,"currentPage":1,"pageSize":1000}
ree2 = requests.post(url2,data=json.dumps(data2),headers=headers2)
re2 = json.loads(ree2.text)
list2=re2['data']['records']
dic1={}
for i in list2:
    dic1[i['employeeId']]=i['contractStartDate']
# print(dic1)
num=0
for key,value in dic1.items():
    if aa.get(key) == value:
        num = num + 1
        print(num,f"{key}的值相等")
    else:
        if aa.get(key) is None:
            print(key,'不在员工档案中')
        else:
            print(f"{key}的值不相等")
#员工重要信息完整度
# url3='http://172.16.70.246/test/oa_personnel/riskControl/pageEmployeeInfoIntegrity'
# headers3={'Authorization':token,'Content-Type':'application/json'}
# data3={"employeeName":"","employeeIdOrName":"","clientIds":[],"accountManagerIds":[],"riskResults":[],"orgIds":[],"reconciliationMonth":"","missingInfoItem":[],"companyManagerId":[],"crmClientIds":[],"riskCloseReasons":[],"reconciliationStartMonth":"","reconciliationEndMonth":"","riskCloseStartDate":"","riskCloseEndDate":"","riskCauseEndTime":"","closeRiskControlReasons":[],"contractStartDateOrder":"asc","contractEndDateOrder":"asc","crmCmAndCms":[],"dateRange":[],"riskLevels":[],"riskCauseStartTime":"","riskProduceDateOrder":"desc","sortFields":"","sortRule":"","pageNo":1,"currentPage":1,"pageSize":1000}
# ree3 = requests.post(url3,data=json.dumps(data3),headers=headers3)
# re3 = json.loads(ree3.text)
# list3=re3['data']['records']
# dic1={}
# for i in list3:
#     dic1[i['employeeId']]=i['contractStartDate']
# # print(dic1)
# num=0
# for key,value in dic1.items():
#     if aa.get(key) == value:
#         num = num + 1
#         print(num,key+"的值相等"+value)
#     else:
#         print(key+"的值不相等")


